﻿<%@ Page Language="C#" MasterPageFile="~/Main.Master" AutoEventWireup="true" CodeBehind="WebForm1.aspx.cs" Inherits="DigDes.DSchool.SUPS.Web.UI.WebForm1" %>


<asp:Content runat="server" ID="BodyContent" ContentPlaceHolderID="MainContent">

    <div>
        <asp:SqlDataSource
            ID="SqlDataSource"
            runat="server"
            ConnectionString='<%$ ConnectionStrings:SUPSConnectionString %>'
            SelectCommand="SELECT Top 20
			Dislocation.CarNumber, --0
			Dislocation.Weight, --1
			StationArr.Name as StationArr, --2
			Cargo.Name as CargoName, --3
			Dislocation.ConsigneeCode, --4
			Dislocation.CarParkType, --5
			StationDisp.Name as StationDisp,--6
			CarOperation.Name as CarOper,--7
			Dislocation.OperationDateTime,--8
			stationOper.Name as stationOper, --9
			RoadDel.Name as RoadDel, --10
			RoadRec.Name as RoadRec, --11
			Dislocation.TrainIndex, --12
			Dislocation.TrainNumber --13
FROM    Dislocation
			left JOIN  Road as RoadDel ON Dislocation.RoadOfDelivery = RoadDel.Code 
			left JOIN  Road as RoadRec ON Dislocation.RoadOfReception = RoadRec.Code 
			left JOIN Station as  stationArr  ON Dislocation.ArrivalStation = stationArr.Station_ID
			left JOIN Station as stationOper ON Dislocation.OperationStation = stationOper.Station_ID
			left JOIN Station as stationDisp ON Dislocation.DispatchStation = stationOper.Station_ID
			left Join Cargo on Dislocation.CargoCode = Cargo.ShortCode
			--left Join ShipmentClient on Dislocation.ConsigneeCode = ShipmentClient.Code
			left Join CarOperation on Dislocation.OperationCode = CarOperation.Code and CarOperation.OperationType = 0
			"></asp:SqlDataSource>


        <asp:GridView ID="GridViewDislocation" runat="server" DataSourceID="SqlDataSource" AutoGenerateColumns="False">
            <Columns>
                <asp:BoundField DataField="CarNumber" HeaderText="Номер вагона" SortExpression="CarNumber"></asp:BoundField>
                <asp:BoundField DataField="Weight" HeaderText="Вес" SortExpression="Weight"></asp:BoundField>
                <asp:BoundField DataField="StationArr" HeaderText="Станция назначения вагона" SortExpression="StationArr"></asp:BoundField>
                <asp:BoundField DataField="CargoName" HeaderText="Название груза" SortExpression="CargoName"></asp:BoundField>
                <asp:BoundField DataField="ConsigneeCode" HeaderText="Код грузополучателя" SortExpression="ConsigneeCode"></asp:BoundField>
                <asp:BoundField DataField="CarParkType" HeaderText="Тип парка вагона" SortExpression="CarParkType"></asp:BoundField>
                <asp:BoundField DataField="StationDisp" HeaderText="Название cтанции начала рейса" SortExpression="StationDisp"></asp:BoundField>
                <asp:BoundField DataField="CarOper" HeaderText="Операция" SortExpression="CarOper"></asp:BoundField>
                <asp:BoundField DataField="OperationDateTime" HeaderText="Дата операции" SortExpression="OperationDateTime"></asp:BoundField>
                <asp:BoundField DataField="stationOper" HeaderText="Станция свершения операции" SortExpression="stationOper"></asp:BoundField>
                <asp:BoundField DataField="RoadDel" HeaderText="Дорога сдачи" SortExpression="RoadDel"></asp:BoundField>
                <asp:BoundField DataField="RoadRec" HeaderText="Дорога приема" SortExpression="RoadRec"></asp:BoundField>
                <asp:BoundField DataField="TrainIndex" HeaderText="Индекс поезда" SortExpression="TrainIndex"></asp:BoundField>
                <asp:BoundField DataField="TrainNumber" HeaderText="Номер поезда" SortExpression="TrainNumber"></asp:BoundField>
            </Columns>
            
        </asp:GridView>

    </div>


</asp:Content>
